namespace Management.Migrations
{
    using System;
    using System.Data.Entity.Migrations;
    
    public partial class CreateConnWithSomeTables : DbMigration
    {
        public override void Up()
        {
            AddColumn("dbo.SiliconCuttings", "EquipmentFileID", c => c.Int(nullable: false));
            AddColumn("dbo.SiliconCuttings", "TeamID", c => c.Int(nullable: false));
            CreateIndex("dbo.SiliconCuttings", "WorkshopID");
            CreateIndex("dbo.SiliconCuttings", "EquipmentFileID");
            CreateIndex("dbo.SiliconCuttings", "SteelWireID");
            CreateIndex("dbo.SiliconCuttings", "SiliconCarbideID");
            CreateIndex("dbo.SiliconCuttings", "SuspensionID");
            CreateIndex("dbo.SiliconCuttings", "BreakedID");
            CreateIndex("dbo.SiliconCuttings", "TeamID");
            AddForeignKey("dbo.SiliconCuttings", "BreakedID", "dbo.Breakeds", "BreakedID", cascadeDelete: true);
            AddForeignKey("dbo.SiliconCuttings", "EquipmentFileID", "dbo.EquipmentFiles", "EquipmentFileID", cascadeDelete: true);
            AddForeignKey("dbo.SiliconCuttings", "SiliconCarbideID", "dbo.SiliconCarbides", "SiliconCarbideID", cascadeDelete: true);
            AddForeignKey("dbo.SiliconCuttings", "SteelWireID", "dbo.SteelWires", "SteelWireID", cascadeDelete: true);
            AddForeignKey("dbo.SiliconCuttings", "SuspensionID", "dbo.Suspensions", "SuspensionID", cascadeDelete: true);
            AddForeignKey("dbo.SiliconCuttings", "TeamID", "dbo.Teams", "TeamID", cascadeDelete: true);
            AddForeignKey("dbo.SiliconCuttings", "WorkshopID", "dbo.Workshops", "WorkshopID", cascadeDelete: true);
            DropColumn("dbo.SiliconCuttings", "WireNum");
            DropColumn("dbo.SiliconCuttings", "CuttingTeamID");
            DropColumn("dbo.SiliconCuttings", "CleaningTeamID");
            DropColumn("dbo.SiliconCuttings", "PastingTeamID");
            DropColumn("dbo.SiliconCuttings", "PlubTeamID");
        }
        
        public override void Down()
        {
            AddColumn("dbo.SiliconCuttings", "PlubTeamID", c => c.Int(nullable: false));
            AddColumn("dbo.SiliconCuttings", "PastingTeamID", c => c.Int(nullable: false));
            AddColumn("dbo.SiliconCuttings", "CleaningTeamID", c => c.Int(nullable: false));
            AddColumn("dbo.SiliconCuttings", "CuttingTeamID", c => c.Int(nullable: false));
            AddColumn("dbo.SiliconCuttings", "WireNum", c => c.String());
            DropForeignKey("dbo.SiliconCuttings", "WorkshopID", "dbo.Workshops");
            DropForeignKey("dbo.SiliconCuttings", "TeamID", "dbo.Teams");
            DropForeignKey("dbo.SiliconCuttings", "SuspensionID", "dbo.Suspensions");
            DropForeignKey("dbo.SiliconCuttings", "SteelWireID", "dbo.SteelWires");
            DropForeignKey("dbo.SiliconCuttings", "SiliconCarbideID", "dbo.SiliconCarbides");
            DropForeignKey("dbo.SiliconCuttings", "EquipmentFileID", "dbo.EquipmentFiles");
            DropForeignKey("dbo.SiliconCuttings", "BreakedID", "dbo.Breakeds");
            DropIndex("dbo.SiliconCuttings", new[] { "TeamID" });
            DropIndex("dbo.SiliconCuttings", new[] { "BreakedID" });
            DropIndex("dbo.SiliconCuttings", new[] { "SuspensionID" });
            DropIndex("dbo.SiliconCuttings", new[] { "SiliconCarbideID" });
            DropIndex("dbo.SiliconCuttings", new[] { "SteelWireID" });
            DropIndex("dbo.SiliconCuttings", new[] { "EquipmentFileID" });
            DropIndex("dbo.SiliconCuttings", new[] { "WorkshopID" });
            DropColumn("dbo.SiliconCuttings", "TeamID");
            DropColumn("dbo.SiliconCuttings", "EquipmentFileID");
        }
    }
}
